<?php
if ($this->session->userdata('logged_in') == TRUE) {
    $this->load->view('view_login_success');
}
?>
<?php $this->load->view('view_pageheader'); ?>
<label class="content_linkBack"><?php echo anchor('con_users', '< Back') ?></label>
<label class="content_this">| ACTIVE MEMBER</label>
<style type="text/css">
    table.register {
        margin: auto;
        margin-top: 5px;
        border: #010101 solid 1px;
        border-left-style: none;
        border-right-style: none;
        text-align: center;
        padding: 5px 5px;
    }
    table.register th {
        color: #000;
        border: #ecebeb solid 1px;
    }
    table.register td {
        border: #ecebeb solid 1px;
    }
    table.register tr:hover {
        background-color: #ffcc99;
    }
    table.register tr td > input {
        cursor: pointer;
    }
</style>
<script type="text/javascript">
    function select_person_id() {
        chk_active.submit();
    }
</script>
<div style="border: red hidden 1px; width: 100%;">
    <table border="0" cellpadding="5" class="register">
        <tr style="text-align: right; background: #fff;">
            <td colspan="8">
               <form action="active_person" id="chk_active" name="chk_active" method="post">
                    <label>เลือกรูปแบบการแสดง : </label>
                    <select id="select_type" name="select_type" onchange="select_person_id();">
                        <option value="-1">Choose...</option>
                        <option value="0">Non-Register</option>
                        <option value="1">Register</option>
                        <option value="2">Default</option>
                    </select>
                </form>
            </td>
            <td>
                <div align="right">
                <a href="Newperson"><img src="../../images/new.png" /></a>
                </div>
            </td>
        </tr>
        <tr style="background-color: #fff">
            <th>ID</th>
            <th>NAME</th>
            <th>SURNAME</th>
            <th>USERNAME</th>
            <th>PASSWORD</th>
            <th>EMAIL</th>
            <th>ACTIVE</th>
            <th>EDIT</th>
            <th>DELETE</th>
        </tr>
        <?php foreach ($data as $show) { ?>
            <tr>
                <td><?php echo $show->person_id . "<br />"; ?></td>
                <td><?php echo $show->name . "<br />"; ?></td>
                <td><?php echo $show->surname . "<br />"; ?></td>
                <td><?php echo $show->username . "<br />"; ?></td>
                <td><?php echo $show->password . "<br />"; ?></td>
                <td><?php echo $show->email . "<br />"; ?></td>
                <td>
                    <form action="active_person" id="update_status_person" name="update_status_person" method="post">
                        <?php
                        if ($show->active != "1") { // check false;
                            echo '<input type="image"  name="update_status_person_id" src="../../images/check_false.png" value="' . $show->active . ':' . $show->person_id . '" />';
                        } else {
                            echo '<input type="image" name="update_status_person_id" src="../../images/check_true.png" value="' . $show->active . ':' . $show->person_id . '" />';
                        }
                        ?>
                    </form>
                </td>

                <td>
                    <form action="Editpersonpage" id="editperson" name="editperson" method="post">
                        <?php
                        echo '<input type="image" name="editperson" src="../../images/4.png" value="' . $show->person_id . '" />';
                        ?>
                    </form>
                </td>

                <td>
                    <form action="active_person" id="delete_person" name="delete_person" method="post">
                        <?php
                        echo '<input type="image" name="delete_person" src="../../images/5.png" value="' . $show->person_id . '" />';
                        ?>
                    </form>
                </td>
            </tr>
        <?php } ?>
    </table>
</div>
<?php $this->load->view('view_pagefooter'); ?>